jQuery.extend({
	/**
	 * 全选或反选复选框
	 */
	checkbox : function(o, container, v){
		if($(o).attr('checked') == 'checked' || v)
			$(container + ' input[type=checkbox]').attr('checked', 'checked');
		else{
			$(container + ' input[type=checkbox]').removeAttr('checked');
		}
	},
});

function loading(){
	$(".qtj-msgbox").remove();
	removeLoading();
	$("body").append("<div class='md-loading-box' id='md-loading'><div class='if if-loading'></div><div class='md-loading'></div></div>");
	var left = ($(document).outerWidth()-$('#md-loading').outerWidth())/2;
	var top = ($(window).outerHeight()-$('#md-loading').outerHeight())/2;
	$("#md-loading").css({left:left+'px'});
	$("#md-loading").css({top:top+'px'});
}


/**
 * JS消息盒子
 * @param msg 信息
 * @param type 类型，有warn、success、error默认为success
 * @param redirect 重定向地址
 * @param timeout 缓冲时间，默认3秒
 * @return
 */
function msgbox(msg,type,redirect,timeout){
	removeLoading();
	$("#msgbox-div").remove();
	type = type ? type : 'success';
	msg = msg ? msg : '数据操作成功！';
	var left = ($(document).width()-240)/2;
	$("body").append("<div id='msgbox-div' class='msgbox-" + type +"'><i class='if if-" + type + "'></i>" + msg +"</div>");
	loading_w = $("#msgbox-div").outerWidth();
	var left = ($(window).width() - loading_w) / 2;
	$("#msgbox-div").css({left:left + 'px'});

	timeout = parseInt(timeout);
	timeout = timeout>0 ? timeout : 3;
	var handle = setTimeout(function(){
		$("#msgbox-div").remove();
		clearTimeout(handle);
		if(redirect) document.location.href = redirect;
	},timeout * 1000);
}

/**
 * 删除数据
 * @param url
 * @param msg
 * @return
 */
function del_confirm(url,msg){
	msg = msg ? msg : '您确定要进行删除操作吗？';
	_confirm(msg,url);
}

/**
 * 删除数据
 * @param container
 * @param msg
 * @param action
 * @return
 */
function delConfirm(container,msg,action){
	msg = msg ? msg : '您确定要进行删除操作吗？';
	var i = confirm(msg);
	if(i){
		addForm(container,action);
	}
}
function _alert (msg) {
	msg = msg ? msg : '您确定要进行此操作吗？';
	return confirm(msg);
}
function _confirm (msg,url) {
	msg = msg ? msg : '您确定要进行此操作吗？';
	html = '<div style="width:300px;">';
	html += '<div>'+msg+'</div>';
	html += '<div style="text-align:center;margin-top:8px"><span class="btn1" onclick="jumpurl(\''+url+'\')">确定</span> <span class="btn2" onclick="$.winRemove()">取消</span></div>';
	html += '</div>';
	$.win_info('',html,'<i class="if if-tips"></i>提示信息');
}
function removeLoading(){
	$("#md-loading").remove();
}
function addForm(container,action,method){
	loading();
	action =  action ?  action : location.href;
	method = method?'get':'post';
	$(container).wrap("<form action='"+action+"' method='"+method+"'></form>");
	$(container).parent("form").submit();
}
//跳转URL
function jumpurl (url) {
	loading();
	$("#msgbox-div").remove();
	jumpurl_handle = setTimeout(function(){
		clearTimeout(jumpurl_handle);
		if(url){
			location.href = url;
		}else{
			history.go(-1);
			removeLoading();
		}
	},0);
}
function save_btn (form) {
	var form = form?form:'';
	$("form"+form+" input[name='is_click_save']").val(1);
	// var data = $("form"+form).serialize();
	// alert(data);
	$("form"+form).submit();
}
//百度地址转坐标
function baidu_address2xy(address,x,y){
	var name_address = address?address:'address';
	var name_x       = x?x:'x';
	var name_y       = y?y:'y';
	var address = $('input[name="'+name_address+'"]').val();

	if(!address){
		alert('地址为空，不能反向解析！');
		$('input[name="'+name_address+'"]').focus();
		return;
	}
	
	loading('正在获取坐标...');
	window.BMap_loadScriptTime = (new Date).getTime();
	jQuery.getScript("http://api0.map.bdimg.com/getscript?v=2.0&ak=l8RoARlYT855XCZklKalvmKb&services=&t="+window.BMap_loadScriptTime, function(){
		removeLoading();
		myGeo   = new BMap.Geocoder();
		myGeo.getPoint(address, function(point){
			if (point) {
				$('input[name="'+name_x+'"]').val(point.lng);
				$('input[name="'+name_y+'"]').val(point.lat);
			}
			removeLoading();
		});
		return;
	});
}
//生成随机密码
function suggest_password(id) {
	var pwchars = "abcdefhjmnpqrstuvwxyz23456789ABCDEFGHJKLMNPQRSTUVWYXZ";
	var passwordlength = 16;
	var passwd = $('#'+id);
	passwdstr = '';
	for ( i = 0; i < passwordlength; i++ ) {
		passwdstr += pwchars.charAt( Math.floor( Math.random() * pwchars.length ) )
	}
	passwd.val(passwdstr);
}

$(document).ready(function(){
	// 没权限的不显示
	$('*[href*="#delete-link"],*[url*="#delete-link"]').remove();
	// 弹出窗口
	$(".win").live('click', function(){
		$(this).win();
		return false;
	});

	//链接点击事件
	$('a').live('click', function () {
		var url 	= $(this).attr('href');
			url 	= url ? url : '';
		var is_jump = true;
		var target  = $(this).attr('target');
			target  = target ? target : '';
		if($(this).hasClass('btn-confirm-opt')){is_jump = false;}
		if($(this).hasClass('fancybox-close')){is_jump = false;}
		if($(this).hasClass('noneAjax')){is_jump = false;}
		if($(this).hasClass('nojump')){is_jump = false;}
		if($(this).hasClass('win')){is_jump = false;}
		if(target){is_jump = false;}

		if(is_jump && url){
			jumpurl(url);
			return false;
		}
	});
	//星级评分
	$('.star-rating .pf_star').live('mousemove',function (e) {
		var offset    = $(this).offset().left;
		var curoffset = e.pageX - offset;
		var value     = (curoffset / $(this).width()) * 100;
		if(value <= 20){
			width = 20;
		}
		else if(value > 20 && value <= 40){
			width = 40;
		}
		else if(value > 40 && value <= 60){
			width = 60;
		}
		else if(value > 60 && value <= 80){
			width = 80;
		}else{
			width = 100;
		}
		// console.log(value+'=>'+width);

		$(this).find('.pf_star_on').width(width+'%');
		$(this).find('input').val(width / 20);
	});
	$('.label-select-box li').live('click', function () {
		if($(this).hasClass('on')){
			$(this).removeClass('on');
			$(this).find('input[type="checkbox"]').removeAttr('checked');
		}else{
			$(this).addClass('on');
			$(this).find('input[type="checkbox"]').attr('checked', 'checked');
		}
	})
	//返回按钮处理
	$('.btn-back,.btn-add,.jump').live('click', function () {
		var url = $(this).attr('href');
			url = url ? url : $(this).attr('url');
			url = url ? url : '';
		jumpurl(url);
		return false;
	});
	// 选中删除,批量操作
	$('.selected-delete,.batch-opt').live('click', function () {
		var url = $(this).attr('url');
			url = url ? url : $(this).attr('href');
			url = url ? url : '';
		var msg = $(this).attr('msg');
		var is_restore = $(this).hasClass('restore-opt');
		var is_delete  = $(this).hasClass('delete-opt');
		if(!url){return false }
		if($('input[name="ids[]"]:checked').size() == 0){
			msgbox('对不起，您尚未选择!', 'error');
			return false;
		}
		var btn_text = '';
		var content  = '';
		if(is_restore){
			btn_text = '还原';
			content  = '您确定要还原选中的吗？'
		}
		if(is_delete){
			btn_text = '删除';
			content  = '您确定要删除选中的吗？删除后将无法恢复'
		}
		msg = msg ? msg : (content ? content : '您确定要删除选中的吗？');

		var btn_confirm_text = $(this).attr('btn-confirm-text');
			btn_confirm_text = btn_confirm_text ? btn_confirm_text : (btn_text ? btn_text : '确定');
		html  = '<style> #winBodyContainer{padding:0px;padding-top:10px;overflow-y:scroll;} </style><div class="confirm-opt-box">'; html += '<div class="win-confirm-content">' + msg + '</div>';
		html += '<div class="win-opt-box"><span class="btn btn-confirm">' + btn_confirm_text + '</span> <span class="btn btn-cancel" onclick="$.winRemove()">取消</span></div>';
		html += '</div>';
		$.win_info('', html, '<i class="if if-tips"></i>提示信息');
		$('.confirm-opt-box .btn-confirm').bind('click', function () {
			loading('正在请求中...');
			$('table').wrap("<form class='ajax-batch-form' action='" + url + "' method='post'></form>");
			var data = $('.ajax-batch-form').serialize();
			$.ajax({
				type: 'post',
				url: url,
				data: data,
				dataType: 'json',
				success: function(data){
					removeLoading();
					$.winRemove();
					if(data.status == 1){
						msgbox(data.info);
						location.reload();
					}else{
						msgbox(data.info, 'error');
					}
				}
			});
		})
		return false;
	});
	// 批量修改
	$('.batch-edit').live('click', function () {
		addForm('table');
	});
	//确定操作
	$(".btn-confirm-opt").live('click', function () {
		var checkbox  = $(this);
		var url       = $(this).attr('url');
			url       = url ? url : $(this).attr('href');
		var del_mod   = $(this).attr('del-class');
		var msg       = $(this).attr('msg');
		var title     = $(this).attr('title');
		var is_restore = $(this).hasClass('restore-opt');
		var is_delete  = $(this).hasClass('delete-opt');
		
		var btn_text = '';
		var content  = '';
		if(is_restore){
			btn_text = '还原';
			content  = '您确定要还原该记录' + (title ? '(' + title + ')' : '') + '吗？'
		}
		if(is_delete){
			btn_text = '删除';
			content  = '您确定要删除该记录' + (title ? '(' + title + ')' : '') + '吗？'
		}
		msg = msg ? msg : (content ? content : '您确定要进行此操作吗？');
		var btn_confirm_text = $(this).attr('btn-confirm-text');
			btn_confirm_text = btn_confirm_text ? btn_confirm_text : (btn_text ? btn_text : '确定');
		html  = '<style> #winBodyContainer{padding:0px;padding-top:10px;overflow-y:scroll;} </style><div class="confirm-opt-box">'; html += '<div class="win-confirm-content">' + msg + '</div>';
		html += '<div class="win-opt-box"><span class="btn btn-confirm">' + btn_confirm_text + '</span> <span class="btn btn-cancel" onclick="$.winRemove()">取消</span></div>';
		html += '</div>';
		$.win_info('', html, '<i class="if if-tips"></i>提示信息');
		$('.confirm-opt-box .btn-confirm').bind('click', function () {
			loading('正在请求中...');
			$.ajax({
				type: 'get',
				url: url,
				dataType: 'json',
				success: function(data){
					removeLoading();
					$.winRemove();
					if(data.status == 1){
						msgbox(data.info);
						$('.' + del_mod).fadeOut('slow', function () {
							$('.' + del_mod).remove();
						});
						if(checkbox.attr('checked')){
							checkbox.removeAttr('checked');
						}else{
							checkbox.attr('checked', 'checked');
						}
					}else{
						msgbox(data.info, 'error');
					}
				}
			});
		})
		return false;
	});
	// 上传选中操作
	$('.win-upload-content .upload-img-box li').live('click', function () {
		var is_multi = $(this).attr('is-multi');
		if(!is_multi){
			$('.win-upload-content .upload-img-box li').removeClass('if-ok');
		}
		if($(this).hasClass('if-ok')){
			$(this).removeClass('if-ok');
		}else{
			$(this).addClass('if-ok');
		}
	});
	// 确定选中文件处理
	$('.confirm-selected-file').live('click', function () {
		var el = $(this).attr('to');
		var is_multi = $(this).attr('is-multi');
		var upload_field = $(this).attr('field');
		$('.win-upload-content .upload-img-box li.if-ok').each(function(){
			var file_id   = $(this).attr('file-id');
			var file_path = $(this).attr('file-path');
			var is_pic    = $(this).attr('is-pic');
			var html      = '<li><a class="nojump ' + (is_pic ? 'view_big_pic' : '') + '" href="' + file_path + '">' + $(this).html() + '</a><span class="cancel delete-select-upload-file" is-mulit="' + is_multi + '" field="' + upload_field + '">X</span></li>';
			if(!$('#' + el).find("input[value='" + file_id + "']").val()){
				if(is_multi){
					$('#' + el).append(html);
					$('.' + upload_field + '-upload-btn').show();
				}else{
					$('#' + el).html(html);
					$('.' + upload_field + '-upload-btn').hide();
				}
			}
			$.winRemove();
		});
	});
	$('.delete-select-upload-file').live('click', function () {
		var is_mulit = $(this).attr('is-mulit');
		var field    = $(this).attr('field');
		if(is_mulit == 0){
			$('.' + field + '-upload-btn').show();
		}
		$(this).parent().remove();
	});
	$('.add-select-user').live('click', function () {
		var items      = $(this).parent().parent();
		var user_field = $(this).attr('user-field');
		var is_mulit   = $(this).attr('is-mulit');
		var user_id    = items.find('.user_id').val();
		var user_name  = items.find('.user_name').text();
		var mobile     = items.find('.mobile').text();

		exist_user_id = $("." + user_field + "-user-select-box input[value='" + user_id + "']").val();
		if(exist_user_id == user_id){
			msgbox('您选择的用户已存在！', 'warn');
			return;
		}
		if(user_name){
			label = user_name + ' (' + mobile + ')';
		}else{
			label = user_id + ' (' + mobile + ')';
		}
		var html  = '<li>'+label;
		html += '<input type="hidden" name="' + user_field + '[]" value="'+user_id+'"> ';
		html += '<span class="delete-select-user" user-field="' + user_field + '" is-mulit="' + is_mulit + '">X</span>';
		html +=	'</li>';
		$('.' + user_field + '-user-select-box .city_id_list').append(html).show();
		items.remove();
		if(is_mulit == 0){
			$.winRemove();
			$('.' + user_field + '-user-select-box .select-user').hide();
		}
	});
	$('.delete-select-user').live('click', function () {
		var is_mulit   = $(this).attr('is-mulit');
		var user_field = $(this).attr('user-field');
		if(is_mulit == 0){
			$('.' + user_field + '-user-select-box .select-user').show();
		}
		$(this).parent().remove();
	});
	
	//加载更多
	$(".load-more").live('click', function () {
		loading();
		var here    = $(this);
		var url     = here.attr('url');
		var data_to = here.attr('data-to');
		if(!url){
			msgbox('URL未配置！', 'error');
		}
		$.ajax({
			type: "get",
			url: url,
			dataType:"json",
			success: function(data){
				removeLoading();
				if(data.status == 1){
					$("." + data_to).append(data.data.html);
					next_url = data.data.page.ajax_next_page;
					if(next_url){
						here.attr('url', next_url);
					}else{
						msgbox('到底了');
						here.remove();
					}
				}
			},
			error : function () {
				removeLoading();
				msgbox('请求失败，请稍候再试！', 'error');
			}
		});
	});

	// 选择省份处理
	$('.ajax-province-change').live('change', function () {
		var request_url  = $(this).attr('url');
		var province_id  = $(this).val();
		var city_option  = '<option value="">-城市-</option>';
		var area_option  = '<option value="">-地区-</option>';
		var is_have_city = $(this).next('.ajax-city-change').size();
		$('.ajax-city-change').html(city_option).hide();
		$('.ajax-area-change').html(area_option).hide();
		if(!province_id || !request_url || !is_have_city){
			return false;
		}
		loading();
		$.ajax({
			url : request_url,
			data : 'parentid=' + province_id,
			type : 'get',
			dataType:'json',
			success : function(json){
				removeLoading();
				if(json.status == 1){
					var list = json.data.list;
					$.each(list, function(i){
						id   = list[i]['id'];
						name = list[i]['name'];
						city_option += '<option value="' + id + '">' + name + '</option>';
					});
					$('.ajax-city-change').html(city_option).show();
				}
			}
		});
	});
	// 选择城市处理
	$('.ajax-city-change').live('change', function () {
		var request_url  = $(this).attr('url');
		var city_id      = $(this).val();
		var area_option  = '<option value="">-地区-</option>';
		var is_have_area = $(this).next('.ajax-area-change').size();
		$('.ajax-area-change').html(area_option).hide();
		if(!city_id || !request_url || !is_have_area){
			return false;
		}
		loading();
		$.ajax({
			url : request_url,
			data : 'parentid=' + city_id,
			type : 'get',
			dataType:'json',
			success : function(json){
				removeLoading();
				if(json.status == 1){
					var list = json.data.list;
					$.each(list, function(i){
						id   = list[i]['id'];
						name = list[i]['name'];
						area_option += '<option value="' + id + '">' + name + '</option>';
					});
					$('.ajax-area-change').html(area_option).show();
				}
			}
		});
	});
	// 复制
	if($('.clipboard')){
		$.getScript("/Public/Js/ZeroClipboard/ZeroClipboard.min.js",function () {
			ZeroClipboard.config( { swfPath: "/Public/Js/ZeroClipboard/ZeroClipboard.swf" } );
			$('.clipboard').each(function () {
				var elem = $(this).attr('for');

				var client = new ZeroClipboard( $(this) );
				client.on( 'ready', function(event) {
					client.on( 'copy', function(event) {
						event.clipboardData.setData('text/plain', $('.' + elem).text());
					});

					client.on( 'aftercopy', function(event) {
						msgbox('复制成功！');
						// console.log('Copied text to clipboard: ' + event.data['text/plain']);
					});
				});

			});
		});
	}

	$('.tags-input').live('click', function () {
		return false;
	});

	var has_ueditor = $('body').has('.ueditor').html();
	if(has_ueditor != null){
		window.UEDITOR_HOME_URL = "/Public/Js/ueditor/";
		$.getScript("/Public/Js/ueditor/ueditor.config.js",function () {
			$.getScript("/Public/Js/ueditor/ueditor.all.min.js",function () {
				var toolbar = [[
					"fullscreen","source","undo","redo","|",
					"drafts","pasteplain","|",
					"simpleupload","insertimage","|",
					"bold","italic","underline","fontborder","forecolor","backcolor","spechars","|",
					"superscript","subscript","justifyleft","justifycenter","justifyright","justifyjustify","indent","lineheight","|",
					"removeformat","fontfamily","fontsize"]];
				$('.ueditor').each(function(){
					var ueditor_id = $(this).attr('id');
					var ueditor_id_type = typeof(ueditor_id);
					if($(this).hasClass('ueditor') && ueditor_id_type == 'string'){
						UE.getEditor(ueditor_id, {
							toolbars: toolbar
						});
					}
				});
			});
		});
	}

	//表单验证处理
	//加载表单验证
	form_tip_type     = 3;//提示类型
	is_win_tip        = false;//提示弹窗
	is_show_all_error = true;//是否显示所有错误信息
	is_return_submit  = true;
	if($("form")){
		$.getScript("/Public/Js/validform/index.js",function () {
			//ajax表单提交
			$('form.ajax-form').live('submit',function () {
				if($('form.ajax-form').find('.Validform_wrong').html()){
					return false;
				}
				if(is_return_submit == false){
					return false;
				}
				
				var url    = $(this).attr('action');
				var method = $(this).attr('method');
				var method = method ? method : 'post';
				var data = $(this).serialize();

				loading('正在提交，请稍候...');
				$.ajax({
					url : url,
					data : data,
					type : method == 'post' ? 'post' : 'get',
					dataType:'json',
					success : function(json){
						removeLoading();
						if(json.status == 1){
							msgbox(json.info);
						}else{
							msgbox(json.info,'error');
						}
						//有返回链接，则跳转
						if(json.url){
							jumpurl(json.url);
						}
					}
				});
				return false;
			});
		});
	}

	
	//点击模块名称显示或隐藏下面内容
	$(".mod_name .name").live('click',function(){
		here = $(this).parent();
		here.nextUntil('.mod_name').slideToggle();
	});
	//点击左侧栏目，显示/隐藏
	$(".left_menu .sort_name").live('click',function () {
		$(this).nextUntil('.sort_name','ul').slideToggle();
	});
	//初始化显示选中栏目
	$(".left_menu li.on").parentsUntil('.sort_name').show();

	$('.ajax_checkbox').live('click',function () {
		var url  = $(this).attr('url');
		var name = $(this).attr('name');
			name = name ? name : '';
		data = 'field=' + name;
		loading('正在修改，请稍候...');
		$.ajax({
			url : url,
			data : data,
			type : 'get',
			dataType:'json',
			success : function(json){
				removeLoading();
				if(json.status = 1){
					msgbox(json.info);
				}else{
					msgbox(json.info,'error');
				}
			}
		});
	});
	//图片旋转
	jQuery.getScript("/Public/Js/jquery-plugin/jQueryRotate.2.2.js", function(){
		//向左旋转
		$('.img_rotate_left').live('click',function () {
			var to = $(this).attr('to');
			var rotate_value = $(this).attr('rotate_value');
			var rotate_value = rotate_value ? parseInt(rotate_value) : 0;
			rotate_value -= -90;
			$(this).attr('rotate_value',rotate_value);

			$('.'+to).rotate({ animateTo:rotate_value});
		});
		//向右旋转
		$('.img_rotate_right').live('click',function () {
			var to = $(this).attr('to');
			var rotate_value = $(this).attr('rotate_value');
			var rotate_value = rotate_value ? parseInt(rotate_value) : 0;
			rotate_value += 90;
			$(this).attr('rotate_value',rotate_value);
			$('.'+to).rotate({ animateTo:90});
		});
	});
	//查看大图
	$.getScript("/Public/Js/jquery-plugin/fancyBox/jquery.fancybox.pack.js?v=2.1.5",function () {
		$("<link>").attr({ 
			rel: "stylesheet",
			type: "text/css",
			href: "/Public/Js/jquery-plugin/fancyBox/jquery.fancybox.css?v=2.1.5"
		}).appendTo("head");
		//点击图片，查看大图
		$('.view_big_pic').fancybox();
	});
	$('.auto-select-box span').live('click',function(){
		var auto_select_list = $(this).parent().parent().parent().find('.auto-select-list');
		$(this).parent().parent().find('input').show();
		$(this).parent().remove();
		if(auto_select_list.html() == null || auto_select_list.html() == ''){
			auto_select_list.remove();
		}
	});
	//自动完成
	$('.autocomplete').live('click',function () {
		var here     = $(this);
		var url      = here.attr('data-url');
		var name     = here.attr('data-name');
		var is_multi = here.attr('is-multi');
			is_multi = is_multi ? is_multi : false;
		var is_tags  = here.hasClass('tags-input');
		if(here.length > 0){
			 here.autocomplete({
				source:function(request, response){
					$.ajax({
						url: url,
						type: "GET",
						dataType:"json",
						data: {query : here.val()},
						success:function(json_data){
							if(jQuery.isEmptyObject(json_data) && is_tags){
								here.next('.tags-add').show();
							}else{
								here.next('.tags-add').hide();
							}
							response( $.map( json_data, function( item ) {
								return {
									label: item.title,
									value: item.value,
								}
							}));
						}
					});
				},
				select: function( event, ui ) {
					var label  = ui.item.label;
					var value  = ui.item.value;
					var html   = '<span>' + label;
						html  += '<input type="hidden" name="'+ name +'" value="' + value + '">';
						html  += '<i class="if if-cancel" onclick="$(this).parent().remove();"></i></span>';

					if(is_multi == false){
						here.hide();
						here.parent().append(html);
					}else{
						//多个处理
						if(here.parent().find('div').hasClass('auto-select-list') == false){
							here.parent().append('<div class="auto-select-list"></div>');
						}
						if(here.parent().find('.auto-select-list').find("input[value='" + value + "']").size()){
							msgbox('您选择的已存在！', 'warn');
							return;
						}
						here.parent().find('.auto-select-list').show().append(html);
					}
					setTimeout(function(){
						here.val('');
					},100);
				},
				autoFocus:false,
				minLength: 1//搜索时，最少1个字符时出结果  
			});
		}
	});
	$('.tags-add').live('click', function () {
		var here    = $(this);
		var url     = here.attr('url');
		var content = here.prev('input').val();
		if(!url){
			msgbox('URL未配置！', 'error');
			return false;
		}
		if(!content){
			return false;
		}
		$.ajax({
			url: url,
			type: "post",
			dataType:"json",
			data: {content : content},
			success:function(json){
				if(json.status == 1){
					var html   = '<span>' + json.data.content;
						html  += '<input type="hidden" name="'+ json.data.field + '[]" value="' + json.data.tags_id + '" />';
						html  += '<i class="if if-cancel" onclick="$(this).parent().remove();"></i></span>';
					if(here.parent().find('div').hasClass('auto-select-list') == false){
						here.parent().append('<div class="auto-select-list"></div>');
					}
					here.parent().find('.auto-select-list').show().append(html);
					here.parent().find('input.autocomplete').val('');
				}
			}
		});
	})
	// $(".autocomplete").live('keydown', function(event){
	// 	is_return_submit = true;
	// 	if(event.keyCode == 13){
	// 		is_return_submit = false;
	// 	}
	// });
	
	//数据全屏查看
	$('.data-full-screen').live('click',function () {
		var _view = $(this).attr('view-class');
		var title = $(this).attr('title');
		_view = _view ? _view : 'data_list';
		title = title ? title : '全屏查看';

		var view_data = $('.' + _view).html();
		var html = '<div class="data_list">' + view_data + "</div>";
		$.win_info('', html, title, true);

		var win_width = $('#winBodyContainer').width();
		var doc_width = $('#winBodyContainer .' + _view + " table").width();
		if(win_width > doc_width){
			$('#winBodyContainer .' + _view + " table").css('width', '100%');
		}
	});
	
});